#!/usr/bin/env python
# -*- coding: utf-8 -*-
import uvicorn
import os

from core.app import create_app

# from config.app import settings

app = create_app()

if __name__ == "__main__":
    print("////////////////////////////////////////////////////////////////////")
    print("//                          _ooOoo_                               //")
    print("//                         o8888888o                              //")
    print("//                         88' . '88                              //")
    print("//                         (| ^_^ |)                              //")
    print("//                         O\  =  /O                              //")
    print("//                      ____/`---'\____                           //")
    print("//                    .'  \\|      |//  `.                         //")
    print("//                   /  \\|||   :  |||//  \                        //")
    print("//                  /  _||||| -:- |||||-  \                       //")
    print("//                  |   | \\\   -  /// |   |                       //")
    print("//                  | \_|  ''\---/''  |   |                       //")
    print("//                  \  .-\__  `-`  ___/-. /                       //")
    print("//                ___`. .'  /--.--\  `. . ___                     //")
    print("//              .'' '<  `.___\_<|>_/___.'  >'''.                  //")
    print("//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //")
    print("//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //")
    print("//      ========`-.____`-.___\_____/___.-`____.-'========         //")
    print("//                           `=---='                              //")
    print("//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //")
    print("//             佛祖保佑       永不宕机      永无BUG                   //")
    print("////////////////////////////////////////////////////////////////////")

    uvicorn.run(
        app='main:app',
        host=os.getenv('UVICORN_HOST', "0.0.0.0"),
        port=int(os.getenv('UVICORN_PORT', 8888)),
        reload=os.getenv('UVICORN_RELOAD', True),
        headers=[
            ("server", "web"),
            ("Set-Cookie", "Path=/; HttpOnly; Secure"),
            ("X-Content-Type-Options", "nosniff"),
            ("X-XSS-Protection", "1"),
            ("Content-Security-Policy",
             "default-src 'self'; style-src * 'unsafe-inline'; img-src * data:; object-src 'self'; script-src * "
             "'unsafe-eval' 'unsafe-inline'; font-src * data:; worker-src * blob:;"),
            ("Referrer-Policy", "no-referrer"),
            ("X-Permitted-Cross-Domain-Policies", "master-only"),
            ("X-Download-Options", "noopen"),
            ("X-Frame-Options", "SAMEORIGIN"),
            ("Strict-Transport-Security", "max-age=225")
        ]
    )
